package com.venn.pvuv;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * Created by venn on 5/22/2018.
 */
public class UserViewDemoReduce extends Reducer<Text, Text, Text, Text> {

    Text keyText = new Text();
    Text valueText = new Text();

    public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        //
        int a = 0;
        for (Text value : values) {
            a += Integer.parseInt(value.toString());
        }
        valueText.set(""+a);
        context.write(key,valueText);
    }

}
